package com.edgclub.edg.fragment;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.edgclub.edg.R;
import com.edgclub.edg.adapter.FindStarAdapter;
import com.edgclub.edg.model.Star;
import com.edgclub.edg.model.User;
import com.edgclub.edg.uc.UnableScrollGridView;

import java.util.ArrayList;

/**
 * EDG之星
 */
public class FindStarFragment extends GzBaseFragment{
	private Activity mActivity;


	private UnableScrollGridView unableScrollGridView_star;
	private FindStarAdapter starAdapter;
	private ArrayList<User> stars;

	public static FindStarFragment newInstance(ArrayList<User> stars) {
		FindStarFragment f = new FindStarFragment();
		Bundle args = new Bundle();
		args.putSerializable("stars", stars);
		f.setArguments(args);
		return f;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		stars = (ArrayList<User>) getArguments().getSerializable("stars");
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		mActivity = getActivity();
		View rootView= inflater.inflate(R.layout.fragment_find_star, container, false);
		return rootView;
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		initView(view);

	}


	private void initView(View view){
		unableScrollGridView_star = (UnableScrollGridView) view.findViewById(R.id.unableScrollGridView_star);
		starAdapter = new FindStarAdapter(mActivity);
		starAdapter.setStars(stars);
		unableScrollGridView_star.setAdapter(starAdapter);
	}




}
